package _record;

import org.junit.Test;

import java.util.HashSet;

/**
 *
 */
public record RecordTest() {
    //Class
    @Test
    public void test1() {
        Order order1 = new Order(1001, "order A");
        System.out.println(order1);

        System.out.println(order1.orderId());
        System.out.println(order1.orderName());

        Order order2 = new Order(1001, "order A");
        System.out.println(order1.equals(order2));

        HashSet<Order> hashSet = new HashSet<>();
        hashSet.add(order1);
        hashSet.add(order2);

        System.out.println(hashSet);
    }
    //Record
    @Test
    public void test2() {
        Order1 order1 = new Order1(1001, "order A");
        System.out.println(order1);

        System.out.println(order1.orderId());
        System.out.println(order1.orderName());

        Order1 order2 = new Order1(1001, "order A");
        System.out.println(order1.equals(order2));

        HashSet<Order1> hashSet = new HashSet<>();
        hashSet.add(order1);
        hashSet.add(order2);

        System.out.println(hashSet);
    }
    @Test
    public void test3() {
        Class<Order1> order1Class = Order1.class;

        // java.lang.Record
        System.out.println(order1Class.getSuperclass().getName());
    }
}
